package com.jwds.digital.bios.business.service.anomaly;

import com.jwds.digital.bios.business.core.enums.HealthConfigType;
import com.jwds.digital.bios.business.core.infrastructure.entity.belt.BeltHealthConfig;

import java.math.BigDecimal;

public class ConfigVerify {

    public static boolean verify(BeltHealthConfig config, BigDecimal value) {
        if (config.getConfigType() == HealthConfigType.RANGE.getType()) {
            return value.compareTo(config.getDeductionRangeMin()) >= 0
                    && value.compareTo(config.getDeductionRangeMax()) <= 0;
        }
        return config.getConfigType() == HealthConfigType.SIGNAL.getType();
    }

}
